package com.example.pceb.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.pceb.VO.RecruitVo;
import com.example.pceb.entity.Recruit;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
@Mapper
public interface RecruitMapper extends BaseMapper<Recruit> {
    default List<Recruit> selectByRecruitVo(RecruitVo vo) {
        LambdaQueryWrapper<Recruit> queryWrapper = new LambdaQueryWrapper<>();

        if (vo.getAddress() != null && !vo.getAddress().isEmpty()) {
            queryWrapper.eq(Recruit::getAddress, vo.getAddress());
        }
        if (vo.getIdentity() != null && !vo.getIdentity().isEmpty()) {
            queryWrapper.eq(Recruit::getIdentity, vo.getIdentity());
        }
        if (vo.getExperience() != null && !vo.getExperience().isEmpty()) {
            queryWrapper.eq(Recruit::getExperience, vo.getExperience());
        }
        if (vo.getEducation() != null && !vo.getEducation().isEmpty()) {
            queryWrapper.eq(Recruit::getEducation, vo.getEducation());
        }
        if (vo.getSalary() != null && !vo.getSalary().isEmpty()) {
            queryWrapper.eq(Recruit::getSalary, vo.getSalary());
        }
        return this.selectList(queryWrapper);
    }
}
